package testwebsocketserver;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;


public class TestWebsocketServer
{

    public static void main(String[] args)
    {
        Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
        
        ServerSocket echoServer = null;
        Socket clientSocket = null;
		InputStream istream = null;
        try
        {
            echoServer = new ServerSocket(9989);
            int clientCounter = 0;
            
            while (true)
            {
                try
                {
                    clientSocket = echoServer.accept();
                    clientCounter++;
                    System.out.println("** Client " + clientCounter + " connected");
                    new RequestProcessor("Thread" + clientCounter, clientSocket).start();
                    System.out.println("** Passed to thread");
                }
                catch (IOException e)
                {
                    System.out.println(e);
                }
            }
        }
        catch (IOException e) {
           System.out.println(e);
        }
    }
}
